package com.surge;

import java.sql.SQLException;

import javax.sql.DataSource;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class SurgeMain {

	private static ApplicationContext ctx;

	public static void main(String[] args) throws SQLException {
		
		
		// 创建 Spring 的 IOC 容器
		ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
		
		/*
		 * 1、作用域singleton
		 */
		DataSource datasource =  (DataSource) ctx.getBean("dataSource");
//		// 作用域为 singleton时，判断是不是同一个bean，及是否为单例
		System.out.println(datasource.getConnection());

		
		System.out.println("============== demo 分隔符 =============");
		
		
	}

}
